/**
 * Copyright 2025 Adobe. All rights reserved.
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */

@import url("./spectrum-popover.css");
@import url("./popover-overrides.css");

:host {
    min-width: min-content;
    max-height: 100%;
    max-width: 100%;
    inline-size: var(--mod-popover-inline-size);
    clip-path: none;
}

::slotted(*) {
    overscroll-behavior: contain;
}

/* orient the tip */

:host([placement*="left"]) #tip[style],
:host([placement*="right"]) #tip[style] {
    inset-block-end: auto;
}

:host([placement*="top"]) #tip[style],
:host([placement*="bottom"]) #tip[style] {
    inset-inline-end: auto;
}

.block,
.inline {
    width: 100%;
    height: 100%;
    display: block;
}

:host([placement*="left"]) .block,
:host([placement*="right"]) .block {
    display: none;
}

:host([placement*="top"]) .inline,
:host([placement*="bottom"]) .inline {
    display: none;
}

::slotted(.visually-hidden) {
    border: 0;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    height: 1px;
    margin: 0 -1px -1px 0;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    white-space: nowrap;
}

::slotted(sp-menu) {
    margin: 0;
}

:host([dialog]) {
    min-width: var(--mod-popover-dialog-min-width, var(--spectrum-popover-dialog-min-width, 270px));
    padding: var(--mod-popover-dialog-padding, var(--spectrum-popover-dialog-padding, 30px 29px));
}

:host([tip][placement]) #tip {
    height: auto;
}
